package com.runlooker.runer.util;

public class JidUtil {

	/**
	 * 从jid中获得帐号
	 * 
	 * @param account
	 * @return
	 */
	public static String getAccountFromJID(String jid) {
		if (!jid.contains("@"))
			return jid;
		String[] res = jid.split("@");
		String userName = res[0];
		return userName;
	}

	/**
	 * 根据帐号封装JID
	 * 
	 * @param account
	 * @return
	 */
	public static String getJIDByAccount(String account, String service,
			String resouce) {
		return account + "@" + service + "/" + resouce;
	}

	/**
	 * 根据帐号封装JID
	 * 
	 * @param account
	 * @return
	 */
	public static String getJIDByAccount(String account, String service) {
		return account + "@" + service;
	}

}
